<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>
      Pomelo
    </title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta http-equiv="content-style-type" content="text/css" />
    <meta http-equiv="content-scripte-type" content="text/javascript" />
    <meta name="author" content="netease" />
    <meta name="version" content="1.0" />
    <meta name="keywords" content="pomelo" />
    <link type="text/css" rel="stylesheet" href="css/base.css" />
    <script src="js/lib/build/build.js" type="text/javascript"></script>
    <script type="text/javascript">
      require('boot');
    </script> 
    <script type="text/javascript">
      var pomelo = window.pomelo;
      // var host = "47.112.239.204";
      host = "127.0.0.1"
      var port = "3010";
      //检查账号是否存在
      var checkAccount = function(unionid) {
          pomelo.request("area.areaHandler.checkAccount",{unionid:unionid}, function(data) {
              console.log(data)
          });
      }
      //获取数据
      var getPlayerInfo = function() {
          pomelo.request("area.areaHandler.getPlayerInfo",{}, function(data) {
              console.log(data)
          });
      }
      //获取船只货物
      var getShipCargo = function() {
          pomelo.request("area.areaHandler.getShipCargo",{}, function(data) {
              console.log(data)
          });
      }
      //领取船只货物奖励
      var gainShipAward = function(shipId) {
          pomelo.request("area.areaHandler.gainShipAward",{shipId:shipId}, function(data) {
              console.log(data)
          });
      }   
      //领取填字游戏奖励
      var gainCrosswordAward = function() {
          pomelo.request("area.areaHandler.gainCrosswordAward",{}, function(data) {
              console.log(data)
          });
      }
      //获取排行榜
      var getAssetsRank = function() {
          pomelo.request("area.areaHandler.getAssetsRank",{}, function(data) {
              console.log(data)
          });
      }
      //解锁地块
      var unlockGrid = function(gridId) {
          pomelo.request("area.areaHandler.unlockGrid",{gridId:gridId}, function(data) {
              console.log(data)
          });
      }
      //解锁建筑
      var unlockBuild = function(buildId) {
          pomelo.request("area.areaHandler.unlockBuild",{buildId:buildId}, function(data) {
              console.log(data)
          });
      }
      //放置建筑
      var placeBuild = function(gridId,buildId) {
          pomelo.request("area.areaHandler.placeBuild",{gridId:gridId,buildId:buildId}, function(data) {
              console.log(data)
          });
      }
      //升级建筑
      var upgradeBuild = function(buildId) {
          pomelo.request("area.areaHandler.upgradeBuild",{buildId:buildId}, function(data) {
              console.log(data)
          });
      }
      //提取收益
      var gainBuildAward = function(gridId) {
          pomelo.request("area.areaHandler.gainBuildAward",{gridId:gridId}, function(data) {
              console.log(data)
          });
      }
      //转接HTTPS接口
      var getHttpsData = function(url) {
          pomelo.request("connector.entryHandler.getHttpsData",{url : url}, function(data) {
              console.log(data)
          });
      }
      //转接HTTP接口
      var getHttpData = function(url) {
          pomelo.request("connector.entryHandler.getHttpData",{url : url}, function(data) {
              console.log(data)
          });
      }
      //获取tick
      var getTick = function() {
          pomelo.request("connector.entryHandler.getTicket",null, function(data) {
              console.log(data)
          });
      }
      //h5登录
      var h5Enter = function(code,appid) {
          pomelo.request("connector.entryHandler.h5Enter",{code : code,appid : appid}, function(data) {
              console.log(data)
          });
      }
      //小游戏登录
      var miniEnter = function(code,appid) {
          pomelo.request("connector.entryHandler.miniEnter",{code : code,appid : appid}, function(data) {
              console.log(data)
          });
      }
      //小游戏获取unionid
      var miniEnter = function(openid,session_key,encryptedData,iv) {
          pomelo.request("connector.entryHandler.miniEnter",{openid : openid,session_key : session_key,encryptedData:encryptedData,iv:iv}, function(data) {
              console.log(data)
          });
      }
      //app登录
      var appEnter = function(code,appid) {
          pomelo.request("connector.entryHandler.appEnter",{code : code,appid : appid}, function(data) {
              console.log(data)
          });
      }
      //登录 unionid为用户唯一标识   首次登录后会生成uid为玩家ID
      var entry = function(unionid,head,name,inviter) {
          pomelo.init({
            host: host,
            port: port,
            log: true
          },function() {
            pomelo.request("connector.entryHandler.entryAccount",{unionid : unionid,head:head,name:name,inviter : inviter}, function(data) {
                console.log(data);
            });
          })
      }
      //接收信息
      pomelo.on("onMessage",function(data) {
        console.log("onMessage")
        console.log(data)
      })
    </script>
  </head>
  <body>
    <div class="g-doc">
      <div class="g-banner" style="border:none">
        <div class="logo">
          <div class="img"></div>
        </div>
      </div>
      <div class="g-background">
        <div class="g-content">
          Welcome to Pomelo
        </div>
      </div>
      <div class="g-link">
        Home:
        <a href="https://github.com/NetEase/pomelo">https://github.com/NetEase/pomelo</a>
      </div>
      <div class="g-button">
        <input id="test" type="button" value="Test Game Server" onclick="show()"/>
      </div>
    </div>
  </body>
</html>
